package ah.szxy.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

/**
 * 测试用Controller
 *
 * @author caohaiyang
 * @create 2020-09-09 下午 03:16
 */
@Controller
public class ProviderController {

    @GetMapping("/data/{message}")
    public ResponseEntity<String> sendMsg(@PathVariable String message){
        return ResponseEntity.ok(String.format("Hello , %s", message));
    }

    @Value("${server.port}")
    private Integer port; //在一台主机上启动多个服务,端口需要不同

    @GetMapping("/data2/{message}")
    public ResponseEntity<String> sendMsg2(@PathVariable String message){
        return ResponseEntity.ok(String.format("Hello , %s, 我是%s", message, port));
    }



}
